let metaEl;
metaEl = document.createElement('meta');
metaEl.setAttribute('name', 'viewport');
if (/Android (\d+\.\d+)/.test(navigator.userAgent)) {
  var version = parseFloat(RegExp.$1);
  if (version > 2.3) {
    var phoneScale = parseInt(window.screen.width) / 750;
    metaEl.setAttribute('content', 'width=750,minimum-scale=' + phoneScale + ',maximum-scale=' + phoneScale + ',target-densitydpi=device-dpi')
  } else {
    metaEl.setAttribute('content', 'width=750,target-densitydpi=device-dpi')
  }
} else {
  metaEl.setAttribute('content', 'width=750,user-scalable=no,target-densitydpi=device-dpi,minimal-ui')
}
document.documentElement.firstElementChild.appendChild(metaEl)

$(document).ready(function(){
  let mySwiper = new Swiper ('.swiper-container', {
    loop: true,
    slidesPerView: 3,
    loopFillGroupWithBlank: true,
    spaceBetween: 10,
    slidesPerGroup: 1,
    autoplay: {
      delay: 2500,
      disableOnInteraction: false,
    },
    // // 如果需要分页器
    // pagination: '.swiper-pagination',
    //
    // 如果需要前进后退按钮
    pagination: {
      el: '.swiper-pagination',
      clickable: true,
    },
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
    // 如果需要滚动条
    scrollbar: '.swiper-scrollbar',
  })
  // 计算导航栏
  window.onscroll = function(){
    let top = $(this).scrollTop()
    if(top > 130){
      $('.nav').addClass('active')
    }else{
      $('.nav').removeClass('active')
    }
  }
})